<!DOCTYPE html>
<html lang="en">
<head>
<title>huangliusong</title>
<script type="text/javascript" src="./vue.js"></script>
</head>
 
<body>
	<div id="app">
		<input type="text" v-model="todoValue"/>
		<button v-on:click="addClick">提交</button>
		<ul>
			<!-- <li v-for="item in list">
				{{item}}
			</li> -->
			<todo-item v-bind:content="item" 
					   v-for="item in list">
				
			</todo-item>
		</ul>
	</div>

	<script type="text/javascript">
		/*Vue.component("TodoItem",{
			props:['content'],
			template:"<li>{{content}}</li>"
		})*/

		var TodoItem={
			props:['content'],
			template:"<li>{{content}}</li>"
		}

		var app=new Vue({
			el:'#app',
			components:{
				TodoItem:TodoItem
			},
			data:{
				list:[],
				todoValue:''
			},
			methods:{
				addClick:function(){
					 var date = new Date(); 
					this.list.push(this.todoValue+"               "+date);
				}
			}
		})
	</script>
</body>

</html>